// 基础颜色
$primary: #3b82f6;
$secondary: #64748b;
$success: #10b981;
$danger: #ef4444;
$warning: #f59e0b;
$info: #06b6d4;
$dark: #1e293b;
$light: #f8fafc;

// 尺寸
$border-radius-sm: 0.25rem;
$border-radius-md: 0.5rem;
$border-radius-lg: 0.75rem;

// 阴影
$shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
$shadow-md:
  0 4px 6px -1px rgba(0, 0, 0, 0.1),
  0 2px 4px -1px rgba(0, 0, 0, 0.06);
$shadow-lg:
  0 10px 15px -3px rgba(0, 0, 0, 0.1),
  0 4px 6px -2px rgba(0, 0, 0, 0.05);

// 基础样式
.candlestick-chart {
  // 亮色主题
  &.light-theme {
    --bg-color: #ffffff;
    --text-color: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --stats-bg: #f8fafc;
    --card-bg: #ffffff;
    --button-inactive: #f1f5f9;
    --button-text-inactive: #475569;
    --button-hover: #e2e8f0;
    --overlay: rgba(255, 255, 255, 0.8);
  }

  // 暗色主题
  &.dark-theme {
    --bg-color: #1e293b;
    --text-color: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --stats-bg: #0f172a;
    --card-bg: #1e293b;
    --button-inactive: #334155;
    --button-text-inactive: #e2e8f0;
    --button-hover: #475569;
    --overlay: rgba(30, 41, 59, 0.8);
  }

  // 图表容器
  .chart-container {
    background-color: var(--bg-color);
    border-radius: 0.75rem;
    box-shadow:
      0 4px 6px -1px rgba(0, 0, 0, 0.1),
      0 2px 4px -1px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  // 控制工具栏
  .control-bar {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;

    .button-group {
      display: flex;
      gap: 0.5rem;
    }

    .time-range-selector,
    .indicators-selector {
      display: flex;
      align-items: center;
      gap: 0.5rem;

      .label {
        font-size: 0.875rem;
        color: var(--text-secondary);
      }
    }

    .indicators-selector {
      margin-left: auto;
    }
  }

  // 按钮样式
  .btn-toggle {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;

    &.active {
      background-color: $primary;
      color: #ffffff;
    }

    &:not(.active) {
      background-color: var(--button-inactive);
      color: var(--button-text-inactive);

      &:hover {
        background-color: var(--button-hover);
      }
    }

    i {
      margin-right: 0.25rem;
    }
  }

  // 图表包装器
  .chart-wrapper {
    flex: 1;
    min-height: 400px;
    position: relative;
  }

  // 加载覆盖层
  .loading-overlay {
    position: absolute;
    inset: 0;
    background-color: var(--overlay);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;

    .spinner {
      width: 3rem;
      height: 3rem;
      border-radius: 50%;
      border: 2px solid transparent;
      border-bottom-color: $primary;
      animation: spin 1s linear infinite;
    }

    .loading-text {
      margin-top: 0.75rem;
      color: var(--text-secondary);
    }
  }

  // 统计信息区域
  .stats-section {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--stats-bg);
  }

  // 统计网格
  .stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
  }

  // 统计卡片
  .stat-card {
    background-color: var(--card-bg);
    padding: 0.75rem;
    border-radius: 0.5rem;
    box-shadow:
      0 1px 3px 0 rgba(0, 0, 0, 0.1),
      0 1px 2px 0 rgba(0, 0, 0, 0.06);
  }

  .stat-title {
    font-size: 0.75rem;
    color: var(--text-secondary);
  }

  .stat-value {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--text-color);

    &.text-primary {
      color: $primary;
    }

    &.text-success {
      color: $success;
    }
  }
}

// 动画
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.c-draw-setting {
  position: relative;
  width: 200px;
  &-title {
    padding: 0 !important;
  }
  &-subtitle {
    font-size: 12px;
    color: #b4b6b8;
    margin-top: 6px;
    margin-bottom: 2px;
  }
  &-face {
    width: 24px;
    height: 24px;
    cursor: pointer;
    transition: background 0.3s;
    &:hover {
      background: rgba(255, 255, 255, 0.12);
    }
    &.is-active {
      background: #37214c !important;
    }
    > div {
      width: 16px;
      height: 16px;
      margin: 4px;
    }
    &-box {
      display: flex;
      flex-wrap: wrap;
      width: 144px;
    }
  }
}

.c-candlestick-line-chart {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  &[data-crosshair="false"] {
    .highcharts-crosshair {
      display: none;
    }
    .highcharts-crosshair-label {
      display: none;
    }
  }
}




// tsss
.annotations-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
  background:rgba(0,0,0,.1);
  .chart-annotation {
    pointer-events: auto;
  }
  
  .text-annotation {
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 4px;
    padding: 4px 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translate(-50%, -100%);
    min-width: 60px;
    
    .annotation-text {
      white-space: nowrap;
    }
    
    .annotation-input {
      width: 120px;
      padding: 2px 4px;
      font-size: 12px;
      border: 1px solid #ddd;
      border-radius: 3px;
    }
  }
  
  .line-annotation {
    background-color: #FF0000;
  }
  
  .rect-annotation {
    border: 2px solid #00FF00;
    background-color: rgba(0, 255, 0, 0.1);
  }
}

// 标注工具按钮样式
.annotation-tools {
  display: flex;
  gap: 8px;
  margin-right: 16px;
  
  .annotation-btn {
    padding: 4px 8px;
    background-color: #f0f2f5;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    
    &:hover {
      background-color: #e6e8eb;
    }
    
    &.active {
      background-color: #1890ff;
      color: white;
      border-color: #1890ff;
    }
  }
}